package com.yingxue.lesson.controller;

import com.yingxue.lesson.aop.annotation.MyLog;
import com.yingxue.lesson.contants.Constant;
import com.yingxue.lesson.entity.SysProduct;
import com.yingxue.lesson.service.ProductService;
import com.yingxue.lesson.utils.DataResult;
import com.yingxue.lesson.utils.JwtTokenUtil;
import com.yingxue.lesson.vo.req.product.ProductPageVO;
import com.yingxue.lesson.vo.resp.PageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.xml.crypto.Data;
import java.util.List;

/**
 * @author lai
 * @version 1.0
 * @date 2021/5/20 9:50
 * @description
 */
@Api(tags = "产品模块")
@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private ProductService productService;


    @ApiOperation(value = "分页查询产品列表")
    @PostMapping("/getListPage")
    public DataResult getProductPage(@RequestBody ProductPageVO vo){
        PageVO<SysProduct> productPage = productService.getProductPage(vo);
        return DataResult.success(productPage);
    }

    @DeleteMapping("/log")
    @ApiOperation(value = "删除产品接口")
    public DataResult deletedLog(@RequestBody List<String> productIds){
        productService.batchDeletedLog(productIds);
        DataResult result=DataResult.success();
        return result;
    }

}
